October
1st,
2004
KPIT Cummins Infosystems Limited is now releasing GNUSH v0403, a cross compiler tool chain for Renesas (formerly Hitachi) SH series of and micro controllers.
SALIENT FEATURES:
NOTE: GDBSH v0402 can be used with GNUSH v0403.
Please refer to the FAQ for details of the patches applied to the gcc-3.4 sources.
ABOUT GNUSH v0403:
Release version: | GNUSH v0403 |
Release Date: | 1st October 2004 |
Platforms Supported: |
|
Windows 9X/NT/2000/XP/ME | |
Languages: | C, C++ |
SH Series: | SH1, SH2, SH2e, SH3, SH3e, SH4 |
Object File Formats: | ELF, COFF |
Please register at http://www.kpitgnutools.com for free technical support.
Please contact http://www.kpitgnutools.com/feedback.php for any feedback or suggestions.
CHANGES IN THIS RELEASE:
This section summarizes the major changes as compared to GNUSH v0402.
GCC:
1 | Along with other libraries, libraries built with -mrenesas option are also distributed with tool chain. Whenever -mrenesas option is passed to compiler, compiler will automatically refer to libraries from "mrenesas" directory |
2 | Attribute "trap_exit" when used with optimization option
-O2 and above produces wrong code. This has been fixed. Following is the simple test case for the same. void foo (void) __attribute__ ((interrupt_handler,trap_exit(32))); void foo (void) { } void foo1(void) __attribute__ ((interrupt_handler,trap_exit(16))); void foo1(void) { } int main(void) { return 0;} |
3 | GNUSH tool chain no longer supports following targets, -m5-compact-nofpu -m5-compact -m5-32media-nofpu -m5-64media-nofpu -m5-64media -m5-32media These unsupported targets are removed. |
4 | Following code gives error, "mstats.c: undefined
reference to `_malloc_stats_r'" in v0402 since malloc_stats was not supoported. Support have been added from v0403. #include<stdio.h> #include<malloc.h> int main(void) { malloc_stats(); mallinfo(); return 0; } |
5 | Following code produces Internal Compiler Error for
v0402, template<template<int< class T< struct A : T<0> { void foo(); template<template<int> class U> friend void A<U>::foo(); }; template<int> struct B {}; A<B> a; This has been fixed. |
6 | A new option "mno-renesas" is added, which selects GCC calling conventions. |
HEW:
1 | HEW support is added to link mrenesas libraries in project. While creating new project, if Renesas calling convention option is clicked then Archive path will get automatically selected for libraries built with mrenesas option. If Renesas calling convention option is selected after creation of project, then a message will pop-up saying user needs to update linker options. |
2 | Following compiler options are added, -ffunction-sections -fdata-sections -fomit-frame-pointer Following linker option is added, --gc-sections Checkbox for KEEP is added in options->linker->sections-><section name>->Advanced similar to checkbox for NOLOAD. |
Disable "NOLOAD" if "KEEP" is checked and vice versa. Checkbox "KEEP" is by default checked for .vects section and for any other section, both checkboxes are in not checked position. | |
The linker option "--gc-sections" will be ignored by COFF tool chain. Garbage collection will not be done in COFF tool chain. So, in case of COFF tool chain, linker option "--gc-sections" is grayed out in not selected position. | |
Linker sections are modified like following, In .text section .text.* is added before etext In .data section .data.* is added before _edata Compiler options "-fdata-sections", "-ffunction-sections" along with linker option "--gc-sections" will optimize code by removing unused variables and functions. |
|
Due to above additions, HEW project created using v0403 GNUSH tool chain cannot be build successfully using GNUSH v0402 and lower versions of tool chain. | |
3 | Macros DEBUG and RELEASE are added in HEW DLL in respective sessions. Call to library routine "_exit()" is done depending on those macros. The function is only called in Debug mode. The "_exit" routine is written in syscalls.c. This file also includes other functions like _lseek, _link, _unlink, _kill, _getpid etc. These functions are not needed most of the time but also get included in syscalls.o along with _exit function. These un-necessary functions amount to more than 1K bytes of program memory. This wastage of memory is avoided by calling _exit routine only in Release mode. |
4 | Default locations for .data and .stack sections in some GNUSH samples were not correct. This has been changed to correct values. |
5 | Call to _hw_initialize is made independent of macro ROMSTART in start.asm of GNUSH tool chain. |
Samples:
1 | File start.S is modified such that call to library routine "_exit()" is made depending on macro DEBUG and RELEASE. |
2 | Macro DEBUG is added for debug mode RAM application and RELEASE is added for release mode ROM application in makefile of samples. |
3 | Default locations for .data and .stack sections in some GNUSH samples were not correct. This has been changed to correct values. |
4 | Call to _hw_initialize is made independent of macro ROMSTART in start.S of GNUSH tool chain. Only in case of EVB7045 samples, call to hw_intialize is dependent on macro RELEASE. |
5 | Intrinsic function set_imask() in inlines.h is modified from EVB7055 sample. |
Documentation:
Application Note on Optimization options of compiler | |
1 | This note mentions about compiler behavior for various code snippets when compiled with optimization options. It also states workaround options to get expected behavior from code snippets. |
Renesas-GNUSH Migration Guide | |
1 |
Following intrinsic functions are modified, set_imask(), get_imask() |
Known problems:
SH-COFF and SH-ELF:
1 | Windows 9X has restriction on the length of command line that can be given. Due to this, |
1. When the tool chain shortcut from 'Start' menu is invoked, the relevant batch file may not be found and Windows 9X may display an error. | |
2. In HEW (High-performance Embedded Workshop),this restriction may cause problems during linking. | |
Please refer to the following link for further details on this. http://www.kpitgnutools.com/phpmyfaq/index.php?sid=2884&aktion=artikel&rubrik=001006&id=151&lang=en |
|
2 | Following code gives warning "will never be executed"
for " return (val);" statement in "Factorial" function with "-O2" and "-Wunreachable-code"
commandline options. float foo (float X) { float val = 1.0; int k,j; for (k=1; k < 5; k++) { val += 1.0; } return (val); } This can be avoided by using volatile variable in the "foo" function. |
3 | Following code gives Internal Compiler Error for targets
SH2e, SH3e, SH4, SH4-single, SH4-single-only with -O2 optimization
option, double bar (int x, int z1, double z2) { int y; if (z1 > z2) y = z1 + z2; else y = 0; return ((double) x + y); } Workaround is to pass option -fno-cse-follow-jumps with -O2. |
4 | Libraries built with -mrenesas option for SH2 & SH3 little endian targets are not working correctly. |
SH-COFF:
1 | If the symbol in pc relative move instruction is external and is undefined, the linker does not complain about undefined symbol. And if the symbol is in other section, it is not relocated. |
2 | When libc routines like printf, sprintf is used in program and if program
is compiled for SH2/SH2e/SH3/SH3e little endian targets then compiler gives
following error, mprec.c: undefined reference to `__ashiftrt_r4_20' |
3 | Following code gives error "Too many new sections; can't
add ".bss.w35"" when compiled with -fdata-sections option, unsigned int
w00, w01, w02, w03, w04, w05, w06, w07, w08, w09, w10, w11, w12, w13,
w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27,
w28, w29, w30, w31, w32, w33, w34, w35, w36, w37, w38, w39; int main(void) { } |
Change in variable name from w?? to ww?? removes error. | |
4 | Following code gives internal compiler error with any
optimization option, extern int b; int foo (int a) { if (a) { b = 0; for(;;) goto L; } L: for(;;) return 0; } Workaround is to pass an option "-fno-loop-optimize" with optimization option -O2. |
5 | For sh-coff tool chain, -mrelax option does not work. |
SH-ELF:
1 | Following C++
code produces Internal Compiler Error if -O1 is passed with -g option, namespace N { int foo(); struct A { A(); ~A() { if (foo()) foo(); } }; struct B : A {}; struct C : B {}; struct D : C {}; struct E { D d1, d2; }; inline E bar1() { E bar2 (const E&); E e; return bar2(E()); } E e=bar1(); } |